[XEN] Make multicall info explicitly PER_CPU.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 8 Aug 2006 13:48:43 +0000 (14:48 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 8 Aug 2006 13:48:43 +0000 (14:48 +0100)
Also remove cacheline alignment in a few places. We leave
the common timer and schedule_data structures aligned because
they may be accessed randomly by remoted CPUs: at least we can
contain cacheline bouncing to just the offending structures.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/ia64/xen/hypercall.c
xen/arch/x86/domain.c
xen/arch/x86/time.c
xen/common/multicall.c
xen/include/xen/multicall.h

index 20ab2ecda344133188c124fe73753667cc0c7b58..7e9901bc866e515b23597a6798bddc4dee7561e0 100644 (file)
@@ -335,7 +335,7 @@ ia64_hypercall (struct pt_regs *regs)
 unsigned long hypercall_create_continuation(
        unsigned int op, const char *format, ...)
 {
-    struct mc_state *mcs = &mc_state[smp_processor_id()];
+    struct mc_state *mcs = &this_cpu(mc_state);
     struct vcpu *v = current;
     const char *p = format;
     unsigned long arg;
index cdab497e43967ee96d8cdec31510b4c7b68a7883..15baa372aad8dd63fffd7ce4e812195369b3c36b 100644 (file)
@@ -797,7 +797,7 @@ void sync_vcpu_execstate(struct vcpu *v)
 unsigned long hypercall_create_continuation(
     unsigned int op, const char *format, ...)
 {
-    struct mc_state *mcs = &mc_state[smp_processor_id()];
+    struct mc_state *mcs = &this_cpu(mc_state);
     struct cpu_user_regs *regs;
     const char *p = format;
     unsigned long arg;
index 7a8735ee02c34a0b82eb329229a6539876c258de..7ead025e18889385058a14ea961e089ef59c9fa3 100644 (file)
@@ -56,7 +56,7 @@ struct cpu_time {
     s_time_t stime_master_stamp;
     struct time_scale tsc_scale;
     struct timer calibration_timer;
-} __cacheline_aligned;
+};
 
 static DEFINE_PER_CPU(struct cpu_time, cpu_time);
 
index b8c3e5812f8990e5c39ed2e5bed37a87ff271a35..f55926ce8c66a264173bad5ec6ea85f17308012b 100644 (file)
 #include <asm/current.h>
 #include <asm/hardirq.h>
 
-struct mc_state mc_state[NR_CPUS];
+DEFINE_PER_CPU(struct mc_state, mc_state);
 
 long
 do_multicall(
     XEN_GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls)
 {
-    struct mc_state *mcs = &mc_state[smp_processor_id()];
+    struct mc_state *mcs = &this_cpu(mc_state);
     unsigned int     i;
 
     if ( unlikely(__test_and_set_bit(_MCSF_in_multicall, &mcs->flags)) )
index 216e2104eeac224caad3b5c207367065d7e2b6f2..5d8b4db1ca933eb6b44684e22ba13aa392786256 100644 (file)
@@ -5,6 +5,7 @@
 #ifndef __XEN_MULTICALL_H__
 #define __XEN_MULTICALL_H__
 
+#include <xen/percpu.h>
 #include <asm/multicall.h>
 
 #define _MCSF_in_multicall   0
@@ -14,8 +15,8 @@
 struct mc_state {
     unsigned long flags;
     struct multicall_entry call;
-} __cacheline_aligned;
+};
 
-extern struct mc_state mc_state[NR_CPUS];
+DECLARE_PER_CPU(struct mc_state, mc_state);
 
 #endif /* __XEN_MULTICALL_H__ */